﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using Neo4jRestSharp.Neo4jObjectServices;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Neo4jRestSharp
{
	public class Relationship : PropertyContainer
	{
		private Dictionary<string, string> properties;

		protected override void ParseJson()
		{
			Debug.Assert(nodeObjectServices != null);
			base.ParseJson();
						
			//get relationship type
			Type = jsonObj["type"].Value<string>();
			
			//get start uri
			StartUri = new Uri(jsonObj["start"].Value<string>());
			
			//get end uri
			EndUri = new Uri(jsonObj["end"].Value<string>());			
		}

		public void Delete()
		{			
			nodeObjectServices.RemoveRelationship(this);
		}

		public string Type { get; private set; }
		public Uri StartUri { get; private set; }
		public Uri EndUri { get; private set; }
	}
}